package com.eascs.banknet.boc.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.eascs.banknet.boc.vo.boc002.BOC002Element;
import com.eascs.banknet.common.dao.BaseO2oDao;
import com.eascs.common.util.StringUtil;

@Repository("boc002Dao")
public class BOC002Dao extends BaseO2oDao{
	public List<BOC002Element> queryData(String startId){
		StringBuffer sql = new StringBuffer();
		sql.append("select DISTINCT(t2.bank_applyno) 'APPNO' from o2o_loanapply t1, o2o_loan_user t2")
			.append(" where t2.bank_status is not null and t1.wf_type != 'T' and (t1.data_source is null or t1.data_source!='2') ")
			.append(" and t2.bank_status not in('0148','01B3','0149','01ZZ')")
			.append(" and t1.bank_type = 'BC'");
		if(StringUtil.hasText(startId)){
			sql.append("   AND t2.bank_applyno > '").append(startId).append("' ");
		};
		sql.append(" ORDER BY t2.bank_applyno LIMIT 30 ");
		return super.findEntitys(sql.toString(), BOC002Element.class);
	}
	
	public int updateInfo(String status, String appno){
		String sql = "UPDATE o2o_loan_user SET BANK_STATUS=? where BANK_APPLYNO=?";
		return super.execute(sql, status, appno);
	}
}
